package com.cz.register;

import java.util.Random;

public class homework01 {
    public static void main(String[] args) {
        // 定义长度为6的数组arr
        int[] arr = new int[6];
        // 创建随机数Random对象r
        Random r = new Random();
        // 定义求和变量sum
        int sum = 0;
        // for循环遍历数组
        for (int i = 0;i <= 5; i++) {
            // 根据遍历的下标创建随机数存入数组
            arr[i] = r.nextInt(99);
            System.out.println(arr[i]);
            // 计算数组内所有随机数的和
            sum += arr[i];
        }
        System.out.println(sum);

    }
}
